/*
 * addon_intf.h
 *
 *  Created on: 2010-1-7
 *      Author: gavinkwoe
 */

#ifndef ADDON_ENTRY_H_
#define ADDON_ENTRY_H_

#include "addon_features.h"
#include "addon_std.h"
#include "addon_objbase.h"

/*************************************************************************
* INTERFACE
*************************************************************************/

// [Godwin]: considering to adapt multi-threading model ???
ADDON_INTERFACE_( IAddonEntry, 1, IObject )
{
	__INHERIT_FROM( IObject )

	ADDON_METHOD( SetObserver )	( ADDON_REF(IObject) thiz, IN ADDON_REF(IObject) obsvr );

	ADDON_METHOD( OnLoad )		( ADDON_REF(IObject) thiz, IN ADDON_REF(IObject) system );
	ADDON_METHOD( OnUnload )	( ADDON_REF(IObject) thiz );

	ADDON_METHOD( GetUser )		( ADDON_REF(IObject) thiz, OUT unsigned long * pcnt );
	ADDON_METHOD( Lock )		( ADDON_REF(IObject) thiz );
	ADDON_METHOD( Unlock )		( ADDON_REF(IObject) thiz );

	ADDON_METHOD( Support )		( ADDON_REF(IObject) thiz, IN unsigned short * ext_name, OUT unsigned long * pret );
	ADDON_METHOD( Invoke )		( ADDON_REF(IObject) thiz, IN char * cmd_name, IN void ** cmd_args, OUT void * result );
};

/*************************************************************************
* MACRO
*************************************************************************/

#define IAddonEntry_VTBL( p )					ADDON_GET_VTBL_(p, IAddonEntry)
#define IAddonEntry_CALL( p, a )				IAddonEntry_VTBL(p)->a
#define IAddonEntry_OnLoad( p, a )				IAddonEntry_CALL( p, OnLoad )( p, a )
#define IAddonEntry_OnUnload( p )				IAddonEntry_CALL( p, OnUnload )( p )
#define IAddonEntry_GetUser( p, a )				IAddonEntry_CALL( p, GetUser )( p, a )
#define IAddonEntry_Lock( p )					IAddonEntry_CALL( p, Lock )( p )
#define IAddonEntry_Unlock( p )					IAddonEntry_CALL( p, Unlock )( p )
#define IAddonEntry_Support( p, a, b )			IAddonEntry_CALL( p, Support )( p, a, b )
#define IAddonEntry_Invoke( p, a, b, c )		IAddonEntry_CALL( p, Invoke )( p, a, b, c )
#define IAddonEntry_SetObserver( p, a )			IAddonEntry_CALL( p, SetObserver )( p, a )
#define IAddonEntry_GetObserver( p, a )			IAddonEntry_CALL( p, GetObserver )( p, a )

#endif /* ADDON_ENTRY_H_ */
